<html>
<head><meta charset="utf-8"><title>lookup and update HashMap entry without owning key · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/lookup.20and.20update.20HashMap.20entry.20without.20owning.20key.html">lookup and update HashMap entry without owning key</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="222123961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/lookup%20and%20update%20HashMap%20entry%20without%20owning%20key/near/222123961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ambiso <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/lookup.20and.20update.20HashMap.20entry.20without.20owning.20key.html#222123961">(Jan 08 2021 at 20:49)</a>:</h4>
<p>Can I look up and update a HashMap entry without owning the key? (or cloning it)</p>



<a name="222124366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/lookup%20and%20update%20HashMap%20entry%20without%20owning%20key/near/222124366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/lookup.20and.20update.20HashMap.20entry.20without.20owning.20key.html#222124366">(Jan 08 2021 at 20:53)</a>:</h4>
<p><code>.get_mut(&amp;key)</code>?</p>



<a name="222124482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/lookup%20and%20update%20HashMap%20entry%20without%20owning%20key/near/222124482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/lookup.20and.20update.20HashMap.20entry.20without.20owning.20key.html#222124482">(Jan 08 2021 at 20:54)</a>:</h4>
<p>if you want to possibly insert at the same time, that will need <code>raw_entry_mut</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>